package com.ashley.day_0607;

import java.util.Scanner;

public class ArrayExer {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入学生人数： ");
		int number = scanner.nextInt();

		int[] scores = new int[number];
		System.out.println("请输入" + number + "个成绩： ");
		for (int i = 0; i < scores.length; i++) {
			scores[i] = scanner.nextInt();
		}
		int maxScores = 0;
		for (int i = 0; i < scores.length; i++) {
			if (scores[i] > maxScores) {
				maxScores = scores[i];
			}	
		}
		System.out.println("最高分是： " + maxScores);
		
		char level;
		for (int i = 0; i < scores.length; i++) {
			if (maxScores - scores[i] <= 10) {
				level = 'A';
			} else if (maxScores - scores[i] <= 20) {
				level = 'B';
			} else if (maxScores - scores[i] <= 30) {
				level = 'C';
			} else {
				level = 'D';
			}
			System.out.println("student " + i + " scores is " + scores[i] + " grade is " + level);
		}
	}
}
